﻿{include file="public/header" /}
	<form method="post" class="form-x" action="{if $data.id}?id={$data.id}{/if}">
	<div class="panel admin-panel">
		<div class="panel-head"><strong>{:lang('currency')['edit']}</strong></div>
            <br/>
            <script>
                //city canshu
                var pid='{:input("get.pid")}';
                var cid='{:input("get.cid")}';
                var aid='{:input("get.aid")}';
                if(!aid){
                    var pid='{$data.pid}';
                    var cid='{$data.cid}';
                    var aid='{$data.aid}';
                }
                var selectc=true;
                var selecta=true;
                function select_p() {
                }
                function select_c() {
                }
                function select_a() {
                    location.href = '?pid='+pid+'&cid='+cid+'&aid='+aid;
                }
            </script>

            <div class="form-group">
                <div class="label">
                    <label>{:lang('currency')['city']}</label>
                </div>
                <div class="field">
                    {include file="public/city" /}
                </div>
            </div>
            {if input('get.aid') || $data.aid}
                <div class="form-group">
                    <div class="label">
                        <label>关联商家</label>
                    </div>
                    <div class="field">
                        <ul class="list-inline" style="padding: 0;margin-top: 8px">
                            <li>
                                <label>
                                    <input type="checkbox" id="_box" name="seller_id[]" value="" onclick="$('.box').removeAttr('checked');" {if !$data.seller_id}checked="checked"{/if} /> 全部
                                </label>
                            </li>
                            <br>
                            {foreach $seller as $k => $v}
                                <li>
                                    <label>
                                        <input type="checkbox" class="box" name="seller_id[]" onclick="$('#_box').removeAttr('checked');" id="{$v.id}_box" value="{$v.id}" /> {$v.name}
                                    </label>
                                </li>
                            {/foreach}
                        </ul>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>红包标题</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input input-auto" id="title" name="title" value="{$data.title}" size="20" placeholder="请输入红包标题" data-validate="required:{:lang('currency')['required']}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>数量</label>
                    </div>
                    <div class="field">
                        <input type="number" class="input input-auto" id="number" name="number" value="{$data.number}" size="20" placeholder="请输入发放数量" data-validate="required:{:lang('currency')['required']}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>满足条件</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input input-auto" id="full" name="full" value="{$data.full}" size="30" placeholder="请输入满足条件，否则无门槛" data-validate="required:{:lang('currency')['required']}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>红包金额</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input input-auto" id="minus" name="minus" value="{$data.minus}" size="30" placeholder="请输入减免金额" data-validate="required:{:lang('currency')['required']}" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>有效时间</label>
                    </div>
                    <div class="field">
                        <input type="number" class="input input-auto" id="indate" name="indate" value="{$data.indate}" size="30" placeholder="请输入有效时间" data-validate="required:{:lang('currency')['required']}" /> 天
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label>使用时间</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input input-auto" id="intime" name="intime" value="{$data.intime}" size="30" placeholder="请输入使用时间" /> 如：10-12限制10点至12点使用，不填则不限制
                    </div>
                </div>
                <div class="form-button">
                    <button class="button bg-main" type="submit">{:lang('form')['submit']}</button>
                </div>
                <br>
            {else}
                <div class="form-group" style="margin-bottom: 10px">
                    <div class="label">
                        <label></label>
                    </div>
                    <div class="field">
                        请选择城市后设置
                    </div>
                </div>
            {/if}
		</div>
	</form>
{if input('get.aid') || $data.aid}
<script>
    var seller = '{$data.seller_id}';
    var seller_array = seller.split(',');
    for(var i in seller_array){
        if(seller_array[i])
            document.getElementById(seller_array[i]+'_box').checked = 'checked';
    }
</script>
{/if}
{include file="public/footer" /}